{extend name="public:member" /}
{block name="content"}	
<div class="page-header">
	<h1>	
		{$breadcrumb1}
		<small>
			<i class="ace-icon fa fa-angle-double-right"></i>
			{$breadcrumb2}
		</small>
	</h1>
</div>

<table class="table table-striped table-bordered table-hover search-form">
	<thead>
		<th><input name="title" type="text" placeholder="标题" value="{:input('title')}" /></th>
		
		<th>    				
			<select name="is_pay">				
					<?php $is_pay=input('is_pay'); ?>
					<option value="">-所有活动类型-</option>							
					<option {if condition="isset($is_pay) and ($is_pay eq 0) "} selected="selected"{/if} value="0">免费</option>		
					<option {if condition="$is_pay eq 1"} selected="selected"{/if} value="1">付费</option>	
			</select>
		</th>
		
		<th>    				
			<select name="pay_status">				
					<?php $pay_status=input('pay_status'); ?>
					<option value="">-所有付款状态-</option>						
					<option {if condition="isset($pay_status) and ($pay_status eq 0) "} selected="selected"{/if} value="0">未付款</option>			
					<option {if condition="$pay_status eq 1"} selected="selected"{/if} value="1">已付款</option>		
					<option {if condition="$pay_status eq 2"} selected="selected"{/if} value="2">已退款</option>	
			</select>
		</th>
		
		<th>    				
			<select name="cat">
				<option value="">-所有分类-</option>
				
				{volist name="category" id="cat"}
					<option {if condition="input('cat') eq $cat['id']"} selected="selected"{/if} value="{$cat.id}">{$cat.title_show}</option>
				{/volist}
				
			</select>
		</th>
		<th>
			<a class="btn btn-primary" href="javascript:;" id="search" url="{:url('Join/me')}">查询</a>
			<a class="btn btn-primary" href="javascript:;" id="export" url="{:url('Join/export_me_excel')}">导出</a>
		</th>
	</thead>
</table>
	
<div class="row">
	<div class="col-xs-12">	
		<div>
			<table class="table table-striped table-bordered table-hover">
				<thead>
					<tr>
						<th>标题</th>						
						<th>分类</th>						
						<th>姓名</th>
						<th>联系电话</th>
						<th>所需金额(元)</th>
						<th>是否付款</th>		
						
						<th>付款时间</th>	
						<th>报名时间</th>	
						
						<th>操作</th>	
					</tr>
				</thead>
				<tbody>
						
						{volist name="list" id="d" empty="$empty"}
						<tr>
							<td>
								{$d.item_title}
							</td>
							<td>
								{$service->get_item_category_info($d['cid'],'name')}
							</td>
							<td>{$d.name}</td>
							<td>{$d.tel}</td>
							<td>{$d.money}</td>
							<td id="upay{$d.ma_id}">
								{switch name="d.pay_status"}
									{case value="0"}<span class="red">未付款</span> / <a id="pay{$d.ma_id}" class="pay" pay_id="{$d.ma_id}" style="cursor:pointer;">去付款</a>{/case}
									{case value="1"}<span class="green">已付款</span>{/case}
									{case value="2"}已退款{/case}
								{/switch}
							</td>
							<td>
								{if condition="$d['pay_time'] eq 0"}
									无
								{else /}
									{$d.pay_time|date="y-m-d",###}
								{/if}
							</td>
							<td>
								{if condition="$d['create_time'] eq 0"}
									无
								{else /}
									{$d.create_time|date="y-m-d",###}
								{/if}
							</td>
							<td>
								<a title="查看" class="btn btn-xs btn-info" href=''>
									<i class="fa fa-eye bigger-120"></i>
								</a> 
							</td>
						</tr>
						{/volist}
						<tr>
							<td colspan="20" class="page">{$list->render()}</td>
						</tr>
						<tr>
							<td colspan="20">总计 {$list->total()|default="0"} </td>
						</tr>
				</tbody>
				
			</table>
		</div>
	</div>
</div>
{/block}
{block name="javascript"}
<script>
$(function(){
	
	$("#search").click(function () {
        var url = $(this).attr('url');
        var query = $('.search-form').find('input,select').serialize();
        query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g, '');
        query = query.replace(/^&/g, '');
        if (url.indexOf('?') > 0) {
            url += '&' + query;
        } else {
            url += '?' + query;
        }
        window.location.href = url;
    });
    
	$("#export").click(function () {
        var url = $(this).attr('url');
        var query = $('.search-form').find('input,select').serialize();
        query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g, '');
        query = query.replace(/^&/g, '');
        if (url.indexOf('?') > 0) {
            url += '&' + query;
        } else {
            url += '?' + query;
        }
        window.location.href = url;
    });
    
    $('.pay').click(function(){
		
		var pay_id=$(this).attr('pay_id');
		
		var url="{:url('payment/repayment/payment_list')}"+"/pay_id/"+pay_id;
		
		art.dialog.open(url, {
						id:'apply',
						title: '去付款',
						lock: true
		});
	});
    
});		
</script>
{/block}